package com.br.pathfinding.ui;

import java.awt.FlowLayout;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.JTextArea;

@SuppressWarnings("serial")
public class BarraProgresso extends JFrame {

	JProgressBar current;
	JTextArea out;
	JButton find;
	JLabel lblMaximo;
	int num = 0;

	public BarraProgresso() {
		super("Progresso...");

		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		JPanel pane = new JPanel();
		pane.setLayout(new FlowLayout());
		current = new JProgressBar(0, 50000);
		current.setValue(0);
		current.setStringPainted(true);
		lblMaximo = new JLabel("Maximo: " + current.getMaximum());
		pane.add(current);
		pane.add(lblMaximo);
		setContentPane(pane);
	}

	public void avancar(int numero) {
		if (numero == current.getMaximum()) {
			this.current.setMaximum(this.current.getMaximum()
					+ this.current.getMaximum());
			lblMaximo.setText("Maximo: " + this.current.getMaximum());
		}

		this.current.setValue(numero);
	}

}
